﻿using AutoMapper;
using FreeSql;
using XUCore.Ddd.Domain;
using XUCore.NetCore.FreeSql.Entity;

namespace XUCore.NetCore.FreeSql.Curd
{
    /// <summary>
    /// 主键string类型的 CurdService<para></para>
    /// 基于Curd操作的基类<para></para>
    /// 自动生成 Delete、BatchDelete、SoftDelete、BatchSoftDelete、Get 操作<para></para>
    /// </summary>
    /// <typeparam name="TEntity">数据库实体</typeparam>
    /// <typeparam name="TDto">返回实体</typeparam>
    public abstract class StringCurdService<TEntity, TDto> :
        CurdService<string, string, TEntity, TDto>,
        IStringCurdService<TEntity, TDto>
            where TEntity : EntityFull<string, string>, new()
            where TDto : class, new()
    {
        public StringCurdService(UnitOfWorkManager muowm, IMapper mapper) : base(muowm.Orm, mapper)
        {
            muowm.Binding(repo);
        }
    }
    /// <summary>
    /// 主键string类型的 CurdService<para></para>
    /// 基于Curd操作的基类<para></para>
    /// 自动生成 Create、Update、Delete、BatchDelete、SoftDelete、BatchSoftDelete、Get 操作<para></para>
    /// </summary>
    /// <typeparam name="TEntity">数据库实体</typeparam>
    /// <typeparam name="TDto">返回实体</typeparam>
    /// <typeparam name="TCreateCommand">创建命令</typeparam>
    /// <typeparam name="TUpdateCommand">修改命令</typeparam>
    public abstract class StringCurdService<TEntity, TDto, TCreateCommand, TUpdateCommand> :
        CurdService<string, string, TEntity, TDto, TCreateCommand, TUpdateCommand>,
        IStringCurdService<TEntity, TDto, TCreateCommand, TUpdateCommand>
            where TEntity : EntityFull<string, string>, new()
            where TDto : class, new()
            where TCreateCommand : CreateCommand
            where TUpdateCommand : UpdateCommand<string>
    {
        public StringCurdService(UnitOfWorkManager muowm, IMapper mapper) : base(muowm.Orm, mapper)
        {
            muowm.Binding(repo);
        }
    }
    /// <summary>
    /// 主键string类型的 CurdService<para></para>
    /// 基于Curd操作的基类<para></para>
    /// 自动生成 Create、Update、Delete、BatchDelete、SoftDelete、BatchSoftDelete、Get、GetPage 操作<para></para>
    /// 由于业务不同查询的条件不同，GetPage需要重写
    /// </summary>
    /// <typeparam name="TEntity">数据库实体</typeparam>
    /// <typeparam name="TDto">返回实体</typeparam>
    /// <typeparam name="TCreateCommand">创建命令</typeparam>
    /// <typeparam name="TUpdateCommand">修改命令</typeparam>
    /// <typeparam name="TQueryPageCommand">查询分页命令</typeparam>
    public abstract class StringCurdService<TEntity, TDto, TCreateCommand, TUpdateCommand, TQueryPageCommand> :
        CurdService<string, string, TEntity, TDto, TCreateCommand, TUpdateCommand, TQueryPageCommand>,
        IStringCurdService<TEntity, TDto, TCreateCommand, TUpdateCommand, TQueryPageCommand>
            where TEntity : EntityFull<string, string>, new()
            where TDto : class, new()
            where TCreateCommand : CreateCommand
            where TUpdateCommand : UpdateCommand<string>
            where TQueryPageCommand : PageCommand
    {
        public StringCurdService(UnitOfWorkManager muowm, IMapper mapper) : base(muowm.Orm, mapper)
        {
            muowm.Binding(repo);
        }
    }
    /// <summary>
    /// 主键string类型的 CurdService<para></para>
    /// 基于Curd操作的基类<para></para>
    /// 自动生成 Create、Update、Delete、BatchDelete、SoftDelete、BatchSoftDelete、Get、GetList、GetPage 操作<para></para>
    /// 由于业务不同查询的条件不同，GetList、GetPage需要重写
    /// </summary>
    /// <typeparam name="TEntity">数据库实体</typeparam>
    /// <typeparam name="TDto">返回实体</typeparam>
    /// <typeparam name="TCreateCommand">创建命令</typeparam>
    /// <typeparam name="TUpdateCommand">修改命令</typeparam>
    /// <typeparam name="TQueryCommand">查询列表命令</typeparam>
    /// <typeparam name="TQueryPageCommand">查询分页命令</typeparam>
    public abstract class StringCurdService<TEntity, TDto, TCreateCommand, TUpdateCommand, TQueryCommand, TQueryPageCommand> :
        CurdService<string, string, TEntity, TDto, TCreateCommand, TUpdateCommand, TQueryCommand, TQueryPageCommand>,
        IStringCurdService<TEntity, TDto, TCreateCommand, TUpdateCommand, TQueryCommand, TQueryPageCommand>
            where TEntity : EntityFull<string, string>, new()
            where TDto : class, new()
            where TCreateCommand : CreateCommand
            where TUpdateCommand : UpdateCommand<string>
            where TQueryCommand : ListCommand
            where TQueryPageCommand : PageCommand
    {
        public StringCurdService(UnitOfWorkManager muowm, IMapper mapper) : base(muowm.Orm, mapper)
        {
            muowm.Binding(repo);
        }
    }
}
